#include <stdio.h>
#include <math.h>
double fact(int n)
{
    if (n == 0)
    return 1L;
    return fact(n - 1)*n;
}
int main()
{
    double x, sum = 0, term = 1;
    int n = 1, t = 1;
    printf("输入x：");
    scanf("%lf", &x);
    while (term >= 1e-5) {
        term = pow(x, 2 * n - 1) / fact(2 * n - 1);
        sum += t * term;
        t = -t;
        n++;
    }
    printf("sinx值:%.3lf \n累加了:%d项\n", sum, n - 1);
    return 0;
}
